define("@wsb/guac-widget-shared/c/OlsConfigStore-52bf928d.js",["exports","~/c/_commonjsHelpers","~/c/interopRequireDefault"],(function(e,t,s){"use strict";var o=t.c((function(e){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports})),r=t.c((function(e){function t(e,t){for(var s=0;s1?t-1:0),o=1;o{d.dispatch({source:c.VIEW_ACTION,action:e})},p=e=>{d.dispatch({source:c.SERVER_ACTION,action:e})};d.dispatchViewAction=_,d.dispatchServerAction=p;var h=(global.keyMirror||guac.keymirror)({SET_CONFIG:null,LOAD_CONFIG:null,CLEAR_ERROR:null,UPDATE_I18N:null,CONFIG_WAS_LOADED:null,ERROR_LOADING_CONFIG:null,LOAD_ACCOUNT_INFO:null,ACCOUNT_INFO_WAS_LOADED:null,ERROR_LOADING_ACCOUNT_INFO:null,TOGGLE_PRODUCT_SORTING:null,START_PROVISION_ACCOUNT:null,ACCOUNT_PROVISIONED:null,ERROR_ACCOUNT_PROVISIONED:null}),g={local:{olsHost:"https://{websiteId}.onlinestore.dev-godaddy.com",olsPublishedSiteHost:"https://{websiteId}.dev-mysimplestore.com",olsAccountStatusHost:"https://onlinestore.dev-godaddy.com",reseller:{olsHost:"https://{websiteId}.onlinestore.dev-secureserver.net",olsPublishedSiteHost:"https://{websiteId}.dev-mysimplestore.com",olsAccountStatusHost:"https://onlinestore.dev-secureserver.net"},noProductImage:"//onlinestore.wsimg.com/assets/themes/__master/assets/images/prod_no_image_padded.png",requestRetries:2,requestTimeout:{default:3e4,addToCart:15e3,loadProducts:1e4,loadProduct:25e3,loadSimilarProducts:1e4}},development:{olsHost:"https://{websiteId}.onlinestore.dev-godaddy.com",olsPublishedSiteHost:"https://{websiteId}.dev-mysimplestore.com",olsAccountStatusHost:"https://onlinestore.dev-godaddy.com",reseller:{olsHost:"https://{websiteId}.onlinestore.dev-secureserver.net",olsPublishedSiteHost:"https://{websiteId}.dev-mysimplestore.com",olsAccountStatusHost:"https://onlinestore.dev-secureserver.net"},noProductImage:"//onlinestore.wsimg.com/assets/themes/__master/assets/images/prod_no_image_padded.png",requestRetries:2,requestTimeout:{default:3e4,addToCart:15e3,loadProducts:1e4,loadProduct:25e3,loadSimilarProducts:1e4}},test:{olsHost:"https://{websiteId}.onlinestore.test-godaddy.com",olsPublishedSiteHost:"https://{websiteId}.mysimplestore.test-godaddy.com",olsAccountStatusHost:"https://onlinestore.test-godaddy.com",reseller:{olsHost:"https://{websiteId}.onlinestore.test-secureserver.net",olsPublishedSiteHost:"https://{websiteId}.test-mysimplestore.com",olsAccountStatusHost:"https://onlinestore.test-secureserver.net"},noProductImage:"//onlinestore.wsimg.com/assets/themes/__master/assets/images/prod_no_image_padded.png",requestRetries:2,requestTimeout:{default:3e4,addToCart:15e3,loadProducts:1e4,loadProduct:25e3,loadSimilarProducts:1e4}},production:{olsHost:"https://{websiteId}.onlinestore.godaddy.com",olsPublishedSiteHost:"https://{websiteId}.mysimplestore.com",olsAccountStatusHost:"https://onlinestore.godaddy.com",reseller:{olsHost:"https://{websiteId}.onlinestore.secureserver.net",olsPublishedSiteHost:"https://{websiteId}.mysimplestore.com",olsAccountStatusHost:"https://onlinestore.secureserver.net"},noProductImage:"//onlinestore.wsimg.com/assets/themes/__master/assets/images/prod_no_image_padded.png",requestRetries:2,requestTimeout:{default:3e4,addToCart:15e3,loadProducts:1e4,loadProduct:25e3,loadSimilarProducts:1e4}}};const f={ACTIVE:"ACTIVE",SUSPENDED:"SUSPENDED",ABUSE_SUSPENDED:"ABUSE-SUSPENDED",CANCELLED:"CANCELLED",DB_SEEDED:"DB-SEEDED"};var b=new class extends i{constructor(){super(...arguments),this.state={olsHost:null,olsPublishedSiteHost:null,olsAccountStatusHost:null,noProductImage:null,requestTimeout:{},requestRetries:0,websiteId:null,olsAccountStatus:null,renderMode:null,env:null,fetchingAccount:!1,fetchingConfig:!1,defaultCategory:null,allProductsCategory:{},error:null,errorRetryable:!1,configWasSet:!1,configWasLoaded:!1,productSortingEnabled:!1,resourcesToPreload:{},i18n:{},subscribe_coupon:{},store_page_url:null,checkout_allowed:!0,provisionInProgress:!1,provisionTried:!1,buyNowEnabled:!1,freeShippingLabelEnabled:!1,freeShippingBannerEnabled:!1},(global._||guac.lodash).assign(this.state,this.defaultConfig()),this.register()}defaultConfig(){return{locale:"en-US",store_status:"LIVE",number:{format:{strip_insignificant_zeros:!1,pattern:"[\\d\\,]*(\\.[\\d\\,]+)?",precision:3,thousands_separator:",",significant:!1,decimal_mark:"."}},country_iso3:"USA",country_iso:"US",date_format:"%Y-%m-%d",categories_taxonomy_id:null,featured_products_taxon_permalink:null,defaultCategory:null,allProductsCategory:{},show_coupon:!1,fb_pixel_tracking:!1,tracks_fbe_pixel:!1,ga_ad_tracking:null,taxon_show_extended_details:!1,use_best_match:!1,store_name:null,freeShippingLabelEnabled:!1,freeShippingBannerEnabled:!1,buyNowEnabled:!1,stripe_config:{with_apple_pay:!1,apple_pay_on_cart:!1,apple_pay_on_product_detail:!1,with_payment_request:!1,publishable_key:null,reference_id:null},poynt_config:{application_id:null,business_id:null,sdk_url:null,with_apple_pay:!1},currency:{format:{symbol_first:!0,pattern:"[\\d\\,]*(\\.[\\d\\,]+)?",symbol:"$",precision:2,thousands_separator:",",decimal_mark:"."},code:"USD"},yotpo_config:{app_key:null,script_url:null},i18n:{},subscribe_coupon:{description:null,code:null}}}setState(e){(global._||guac.lodash).assign(this.state,e),this.emit("change")}getState(){return this.state}getCurrentCurrency(){return this.getState().currency.code}getSubscribeCoupon(){return this.getState().subscribe_coupon||{}}getStorePageUrl(){const{store_page_url:e}=this.getState();return e}getCheckoutAllowed(){return this.getState().checkout_allowed}getI18n(){return this.getState().i18n||{}}getWebsiteId(){return this.getState().websiteId}getApiBaseUrl(){const{renderMode:e,olsHost:t,olsPublishedSiteHost:s}=this.getState();return"PUBLISH"===e?s:t}isProvisioned(){const{olsAccountStatus:e,renderMode:t}=this.getState();return"PUBLISH"===t||(s=e,-1!==Object.values(f).indexOf(s));var s}provisionTried(){return this.getState().provisionTried}isProvisionInProgress(){return this.getState().provisionInProgress}getHostConfig(e){const{isReseller:t,env:s,websiteId:o}=e,r=g[s||"local"],n=t?r.reseller:r;return{olsHost:n.olsHost.replace("{websiteId}",o),olsPublishedSiteHost:n.olsPublishedSiteHost.replace("{websiteId}",o),olsAccountStatusHost:n.olsAccountStatusHost}}getDefaultCategory(){return this.getState().defaultCategory}getAllProductsInfo(){return this.getState().allProductsCategory||{}}register(){this.dispatchToken=d.register((e=>{const{action:t}=e,{data:s}=t,{i18n:o}=this.state;let r,n;switch(t.type){case h.SET_CONFIG:n=g[s.env||"local"],this.setState({...this.getHostConfig(s),noProductImage:n.noProductImage,requestTimeout:n.requestTimeout,requestRetries:n.requestRetries,websiteId:s.websiteId,olsAccountStatus:s.olsAccountStatus,renderMode:s.renderMode,env:s.env,configWasSet:!0});break;case h.UPDATE_I18N:this.setState({i18n:(global._||guac.lodash).merge(o,s.staticContent,s.i18n)});break;case h.LOAD_CONFIG:this.setState({fetchingConfig:!0,error:null,errorRetryable:!1});break;case h.LOAD_ACCOUNT_INFO:this.setState({fetchingAccount:!0,error:null,errorRetryable:!1});break;case h.START_PROVISION_ACCOUNT:this.setState({provisionInProgress:!0,error:null,errorRetryable:!1});break;case h.CONFIG_WAS_LOADED:this.setState({fetchingConfig:!1,locale:s.locale,store_status:s.store_status,olsAccountStatus:s.status,number:s.number,country_iso3:s.country_iso3,country_iso:s.country_iso,date_format:s.date_format,currency:s.currency,categories_taxonomy_id:s.categories_taxonomy_id,featured_products_taxon_permalink:s.featured_products_taxon_permalink,defaultCategory:s.default_category,allProductsCategory:s.all_products_category,show_coupon:s.show_coupon,fb_pixel_tracking:s.fb_pixel_tracking,tracks_fbe_pixel:s.tracks_fbe_pixel,ga_ad_tracking:s.ga_ad_tracking,taxon_show_extended_details:s.taxon_show_extended_details,use_best_match:s.use_best_match,store_name:s.store_name,stripe_config:s.stripe_config,poynt_config:s.poynt_config,resourcesToPreload:s.resources_to_preload||{},subscribe_coupon:s.subscribe_coupon,yotpo_config:s.yotpo_config||{app_key:null,script_url:null},configWasLoaded:!0,store_page_url:s.store_page_url,checkout_allowed:s.checkout_allowed,buyNowEnabled:s.buy_now_enabled,freeShippingLabelEnabled:s.free_shipping_label_enabled,freeShippingBannerEnabled:s.free_shipping_banner_enabled});break;case h.ERROR_LOADING_CONFIG:r=this.defaultConfig(),this.setState({fetchingConfig:!1,error:t.error,store_status:r.store_status,number:r.number,country_iso3:r.country_iso3,country_iso:r.country_iso,date_format:r.date_format,currency:r.currency});break;case h.ACCOUNT_INFO_WAS_LOADED:this.setState({fetchingAccount:!1,olsAccountStatus:s.status});break;case h.ERROR_LOADING_ACCOUNT_INFO:this.setState({fetchingAccount:!1,error:t.error});break;case h.TOGGLE_PRODUCT_SORTING:this.setState({productSortingEnabled:s});break;case h.ACCOUNT_PROVISIONED:this.setState({olsAccountStatus:f.ACTIVE,provisionInProgress:!1,provisionTried:!0});break;case h.ERROR_ACCOUNT_PROVISIONED:this.setState({provisionInProgress:!1,provisionTried:!0,error:t.error});break;case h.CLEAR_ERROR:this.setState({error:null})}}))}};e.A=d,e.E=i,e.O=b,e.a=p,e.b=h,e.d=_})),"undefined"!=typeof window&&(window.global=window); //# sourceMappingURL=OlsConfigStore-52bf928d.js.map